#include <glib.h>

void my_int_printf(gpointer data, gpointer user_data)
{
    g_printf("%s data:%d \n", (char*)user_data, GPOINTER_TO_INT(data));

    return;
}

static void test_slist_remove(void)
{
    int i = 0;
    GSList *slist = NULL;
    GSList *clist = NULL;

    for(i=0;i<5;i++) {
        slist = g_slist_append(slist,  GINT_TO_POINTER(i));
    }

    slist = g_slist_insert_before(slist, slist->next, GINT_TO_POINTER(32));
    g_printf("\n");
    g_slist_foreach(slist, my_int_printf, "before remove");

    slist = g_slist_remove(slist, GINT_TO_POINTER(32));

    g_printf("\n");
    g_slist_foreach(slist, my_int_printf, "after remove");

    g_slist_free(slist);
}

int
main (int argc, char *argv[])
{
    g_test_init (&argc, &argv, NULL);

    g_test_add_func ("/slist/remove", test_slist_remove);

    return g_test_run ();
}
